# -*- coding:utf-8 -*-

'''函数'''

#斐波那契数列
def fib(num):
	result=[0,1]
	for i in xrange(num-2):
		result.append(result[-2]+result[-1])
	return result
	
print fib(10)

#关键字参数

def p(name,age=10):
	print '%s\'s age is %d' % (name,age)
	
p('tzj',25)
p('ssss')
p(age=11,name='tangzhijie')
p(name="heh",age=2929)

#阶乘
def factorial(n):
	if n==1:
		return 1
	else:
		return n*factorial(n-1)
		
print factorial(4)
print factorial(5)

#isalnum()用于判断是否是字母或数字
seq=['ab','4a1','41','s2f','@@','...']
print [x for x in seq if x.isalnum()]

def jugde(x):
	return x.isalnum()
	
print filter(jugde,seq)